package org.oslims.domain;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

import com.google.gwt.validation.client.NotEmpty;

@Entity
public class Department extends AbstractBaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 734832848256836844L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@NotEmpty
	@Column(unique = true)
	private String name;

	@NotEmpty
	@Column(unique = true)
	private String abbreviation;

	@ManyToMany(mappedBy = "departments", targetEntity = LabStaff.class, cascade = CascadeType.ALL)
	private List<LabStaff> labStaff = new ArrayList<LabStaff>();

	@OneToMany(mappedBy = "doneIn")
	private List<Analysis> analysis = new ArrayList<Analysis>();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAbbreviation() {
		return abbreviation;
	}

	public void setAbbreviation(String abbreviation) {
		this.abbreviation = abbreviation;
	}

	public List<LabStaff> getLabStaff() {
		return labStaff;
	}

	public void setLabStaff(List<LabStaff> labStaff) {
		this.labStaff = labStaff;
	}

	public void setAnalysis(List<Analysis> analysis) {
		this.analysis = analysis;
	}

	public List<Analysis> getAnalysis() {
		return analysis;
	}

	public String toString() {
		return this.getName();
	}
}
